/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.modules;

import alcatelparser.tags.DefaultParserTag;
import java.io.File;
import java.util.HashMap;

/**
 *
 * @author geniuz
 */
public class Env extends HashMap
{

    private Env()
    {
    }

    public static final Env getEnv()
    {
        if(_env == null)
            _env = new Env();
        return _env;
    }

    public final boolean isBinary()
    {
        String s = getProperty(I.I(1352));
        return I.I(1368).equals(s);
    }

    public final boolean isAutoSourceFileSettingsDefine()
    {
        String s = getProperty(I.I(1352));
        return I.I(1339).equals(s);
    }

    public final boolean isRepairMode()
    {
        String s = getProperty(I.I(1310));
        return I.I(1344).equals(s);
    }

    public final boolean isWorkConditionsAuto()
    {
        String s = getProperty(I.I(1310));
        return I.I(1339).equals(s);
    }

    public final boolean isStandardMode()
    {
        String s = getProperty(I.I(1310));
        return I.I(1330).equals(s);
    }

    public final boolean isFullForm()
    {
        String s = getProperty(I.I(1249));
        return I.I(1261).equals(s);
    }

    public final boolean isRecordNumbering()
    {
        Boolean boolean1 = (Boolean)get(I.I(1290));
        if(boolean1 == null)
            return false;
        else
            return boolean1.booleanValue();
    }

    public final boolean isSeparateRecords()
    {
        Boolean boolean1 = (Boolean)get(I.I(1270));
        if(boolean1 == null)
            return false;
        else
            return boolean1.booleanValue();
    }

    public final boolean isInitPhase()
    {
        return _initPhaze;
    }

    public final void setInitPhaze(boolean flag)
    {
        _initPhaze = flag;
    }

    public final boolean isCSVParsing()
    {
        return I.I(1266).equals(getProperty(I.I(1231)));
    }

    public final boolean isFullFormParsing()
    {
        return I.I(1261).equals(getProperty(I.I(1249)));
    }

    public final boolean isReducedFormParsing()
    {
        return I.I(1245).equals(getProperty(I.I(1249)));
    }

    public final boolean isTraceWindowParsing()
    {
        return I.I(1225).equals(getProperty(I.I(1231)));
    }

    public final String getProperty(String s)
    {
        return ApplicationSettings.getInstance().getProperty(s);
    }

    public final int getNumberOfSS()
    {
        //ResultTagPanel resulttagpanel = (ResultTagPanel)get(I.I(824));
        //return Integer.parseInt(resulttagpanel.getSSNumberTextField().getText());
        return 1;
    }

    public final String getRunDir()
    {
        //RegistryKey registrykey = new RegistryKey(RootKey.HKEY_LOCAL_MACHINE, I.I(793));
        //if(registrykey.hasValue(I.I(810)))
        //    return registrykey.getValue(I.I(810)).getStringValue();
        //else
            return ".";
    }

    public final String getTargetDir()
    {
        String s = ApplicationSettings.getInstance().getProperty(I.I(769));
        if(s == null)
            s = (new StringBuilder()).append(getRunDir()).append(File.separator).append(I.I(786)).toString();
        return s;
    }

    public final String getSourceDir()
    {
        String s = ApplicationSettings.getInstance().getProperty(I.I(592));
        if(s == null)
            s = (new StringBuilder()).append(getRunDir()).append(File.separator).append(I.I(609)).toString();
        return s;
    }

    public final boolean isFieldsDecoding()
    {
        Boolean boolean1 = (Boolean)get(I.I(573));
        if(boolean1 == null)
            return false;
        else
            return boolean1.booleanValue();
    }

    public final boolean isIncludeEmptyFields()
    {
        Boolean boolean1 = (Boolean)get(I.I(550));
        if(boolean1 == null)
            return false;
        else
            return boolean1.booleanValue();
    }

    public final boolean isPrintHeader()
    {
        return DefaultParserTag.isTagChecked(I.I(313));
    }

    public final String getLastParseResultText()
    {
        Object obj = get(I.I(289));
        return obj != null ? obj.toString() : "";
    }

    private static final String INSTALL_FOLDER_PATH = "SOFTWARE\\Alcatel";
    private static final String INSTALL_FOLDER_PATH_VALUE = "InstalledPath";
    private boolean _initPhaze;
    private static final String TRUE = "true";
    private static Env _env;
}